home *** CD-ROM | disk | FTP | other *** search
- BPB-37.TOS by Domenico De Vitto <ddv@uk.ac.bton.unix> (only till 1/7/1995)
-
- Well this the first bit o' program that I am going to fling into the
- big wide world, and I'm only doing it because I'm off ill and this is one
- (the one ?) bit of program that works 100% and cannot be improved
- (I think ...) that I have ever wrote.
- First it was written many years ago (1989-1990???), not based or idea
- copied from anything, it simply tells you all about the boot sector details
- of a drive and also gets the lower-screen-half from the TOS, in case you
- need to compare the details.
-
- MOST IMPORTANT: I love Lucy Jane Bruton, and dedicate this to her. (ahhh).
-
- As you all thought that was a copyright notice and naturally skipped it, I
- needn't be embarresed further in the document so anwards & upways...
-
- Running it ...
- It should have a 'TOS' extention because of its nature but I haven't seen
- any difference when it has a PRG or TTP extention so it can be changed.
- It is meant to be run from the desktop so don't moan about it clearing
- you shell screen, anyway I think it looks nice.
-
- Things it does...
- I was going to enter a huge piece of text on its workings but that is
- really boring for all the non-programmers, and they can read the source.
-
- This is what it does:
- If you're in medium-rez it changes down to low - perfectly legal this
- and it's clearer.
-
- Drops the title on the top line.
-
- Gets from the TOS the valid drive letters and displays them.
-
- Gets a key from the keyboard & converts it to uppercase (if a letter!).
-
- If the key is a valid drive letter (bit complex this check) it displays
- the drive you selected (now in uppercase).
-
- Reads in the bootsector from the right drive, even if the disc has just
- been swapped.
-
- If the read sector call returns non-zero - error - tell the user & skip
- the display of the boot sector info.
-
- Otherwaise..
- Displays all the info it can about the boot-sector :
- Boot branch - 'system disks' & the like use this to load the operating
- system, games (can) use it for loading quickly, as do virii.
- - if this is 0 you cannie have a boot-sector virus on the disk.(theory?)
- Volume serial - used by the system to tell if you swapped disks, every disk
- should have a random serial put here at format time for this purpose.
- Bytes per sector - $200 (512 decimal) on most disks - if its not the same
- at the ACTUAL sector size system may(??) go mad as a sponge.
- Sectors per cluster - 'cluster' being the smallest number of sectors one
- file can use on the disk, usually 2 (sectors).
- Reseerved sectors - always at least one as the boot sector counts as the
- first. Used by system-loaders & VERY BIG virii (gulp).
- File Allocation Tables (FATs) (number of) - FATs are used to keep track of
- all the places on the disk where your files are etc. 'Cause the're so
- important there are this many (usually 2) copies updated at the same time.
- Max root dir entries - the largest number of files that you can have in
- the root dir, usually 128 for floppies. Folders are files and can grow
- in size if more file entries (=name,date modified,size in bytes etc)
- are needed, but the root dir is a set size and therfore can only hold
- a limited number of file entries.
- Sectors - the total number of sectorson the media including
- reserved sectors, any hidden sectors, the FATs, the root dir and the
- 'data area' where your files & folders are stored.
- Media descripter - this is meant to describe the media type on PCs
- ie hard disk, 3.5" floppy etc, etc. should really be $F8, but the TOS
- ignores it completely, so it is whatever your formatter sets it to be!
- Sectors per FAT - this is the size in sectors of EACH File Allocation
- Table.
- Sectors per track - The number of sectors per track usually 9 or 10.
- therefore TRACKS = (total sectors / sides on media) / sectors per track.
- Sides on media - for floppies 1 or 2 is valid, but hard disk controllers
- can pull a few tricks on the TOS and pretend there are more 'sides'
- - 64 is not unusual.
- Hidden sectors - this isn't very well documented anywhere, but I think
- these are like 'extra reserved sectors' - comments anyone ?
- Calculated dir sector - worked out as :
- reserved sectors + hidden sectors + (number of FATs * sectors per FAT)
- this should be the first root dir sector.
- I have recently used this info to write zeros to this sector and then ran
- a file system checker (FCHK.TOS) to clean up the mess and leave me with a
- completely clean hard disk partition ! (I wanted this as well!)
-
- Information from the TOS
- This info I added to BPB-37 'cause it gives :
- Total clusters - should be something like (you may need to +/- 1 ? to this)
- (total sectors - system sectors) / sectors per cluster
- where system sectors is
- calculated dir sector +
- ( number of root dir entries * 32 / bytes per sector )
- Free clusters - the number of free clusters.
- Sectors per cluster - a less trustable source of this value than direct
- from the boot sector, but what the TOS THINKS it is.
- Bytes per sector - likewise.
- 'Therefore free space' - free space in bytes (using the TOS values) as
- free clusters * sectors per cluster * bytes per sector
- divided by 1024 to get Kb.
-
- Phew ! After you have read all the info it waits for a keypress (any).
-
- If it was originally in medium rez it changes back and resets the colours
- so the system as it was - all legal calls !!!
-
- Then...... it quits back to the calling desktop/shell etc.
-
- Phew ! - all the equations & algos by the way are from the top of my head
- so don't trust me, check them yourself.
-
- Notes.
- It gives you a lot of info, it fits in 2K (the original version was less
- than 1Kb). It was written in assembly using Genst 1.25 (Thanks ST-Format !)
- and the book 'The conise atari st 68000 programmer's reference guide'
- by Kathrine Peel (one really good book).
-
- Copyrights & the disclaimers
- I wrote this software but you use it at your own risk, so don't get me in
- court is it causes earthquakes in El-Salvador or something.
- You may copy, distribute, BUT NOT SELL IT, modest distribution costs may be
- charged - but remember it's FREE.
-
- If you do pass it on you should pass this doc file on with it so that it's
- ease of use is not lost down the generations.
-
- Please feel free to use the routines in the source code in your own
- programs but bear in mind that once the program all fitted in less than 2K
- I paid no attention to speed, effeciency or 'properness' of the code, but
- I think that it all works properly !
-
- This doc file is toooooo huge for the program now so just remember this:
- If you believe this software to be worth paying for, then pay me 10%
- of what it's worth - thats how much I'd get if I marketed it.
- Course you could simply send me any tips/advice/good jokes and then we
- can get on with the job of writing better software for the ST range.
-
- Any problems/enquiries etc with the program please E-mail me at :
- ddv@uk.ac.bton.unix or surface mail me at :
-
- 1 Green Lane,
- Devizes,
- Wiltshire,
- England.
- SN10 5BL
-
- Yours,
-
- Domenico De Vitto.
-
-
-